package com.yc4;

import com.yc4.user.BankAccount;
import com.yc4.user.BankAccountDao;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;

/**
 * @ClassName App
 * @since: 2023/7/26 14:08
 * @auth: kirito
 * @description:
 **/
public class App {
    public static void main(String[] args) throws SQLException {
        ApplicationContext ac = new AnnotationConfigApplicationContext(config.class);
//        DataSource ds = (DataSource) ac.getBean("myDataSource");
//
//        Connection con = ds.getConnection();
//        System.out.println(con);
        BankAccountDao dao = (BankAccountDao) ac.getBean("bankAccountDao");
        List<BankAccount> all = dao.findAll();
        for (BankAccount b : all) {
            System.out.println(b);
        }
    }
}
